﻿<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="default_step3.aspx.cs" Inherits="JumbotPay.WebFile.Wxpay_Mobile._default_step3" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>订单在线支付</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <script src="/statics/mobile_style/js/rem.js"></script> 
    <script src="/statics/mobile_style/js/jquery.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="/statics/mobile_style/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="/statics/mobile_style/css/page.css?ver=20201120"/>
    <link rel="stylesheet" type="text/css" href="/statics/mobile_style/css/all.css"/>
    <link rel="stylesheet" type="text/css" href="/statics/mobile_style/css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/statics/mobile_style/css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="/statics/mobile_style/css/loading.css"/>
<script type="text/javascript">
	$(window).load(function(){
		$(".loading").addClass("loader-chanage")
		$(".loading").fadeOut(300)
	});


       //调用微信JS api 支付
               function jsApiCall()
               {
                   WeixinJSBridge.invoke(
                   'getBrandWCPayRequest',
                   <%=wxJsApiParam%>,//josn串
                    function (res)
                    {
                        WeixinJSBridge.log(res.err_msg);
           if(res.err_msg == "get_brand_wcpay_request:ok"){  
               alert("微信支付成功!");  
           }else if(res.err_msg == "get_brand_wcpay_request:cancel"){  
               alert("取消支付!");  
           }else{  
              alert("支付失败!");  
           }  
                     }
                    );
               }

               function callpay()
               {
                   if (typeof WeixinJSBridge == "undefined")
                   {
                       if (document.addEventListener)
                       {
                           document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                       }
                       else if (document.attachEvent)
                       {
                           document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                           document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                       }
                   }
                   else
                   {
                       jsApiCall();
                   }
               }
               
</script>
</head>
<!--loading页开始-->
<div class="loading">
	<div class="loader">
        <div class="loader-inner pacman">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
	</div>
</div>
<!--loading页结束-->
	<body>
		<header class="mui-bar mui-bar-nav report-header box-s" id="header">
			<p>订单在线支付</p>
	    </header>
	    <div id="main" class="mui-clearfix contaniner sorder">	    	
	    	<div class="warning clearfloat box-s">
    			提示：请尽快完成支付，逾期将视为无效订单
    		</div>
    		<div class="odernum clearfloat">
    			<ul>
				    <li>商品：<%=Product_Name%></li>
				    <li>描述：<%=Product_Desc%></li>
    				<li>订单编号：<%=Order_ID%></li>
    				<li>订单时间：<%=Order_Time%></li>
    				<li>金额：<span>￥<%=Order_Money %></span></li>
                    <li>收款方：<%=Account_Wxpay_Name%></li>
    			</ul>
    		</div>
    		<div class="pay-method clearfloat">
    			<ul>
    				<li>支付方式</li>
    			</ul>
    		</div>
	    	<div class="addlist clearfloat">
	    		<div class="bottom clearfloat box-s">
	    			<section class="shopcar clearfloat">
						<div class="radio radiosss fr"> 
						    <label class="shopcar-checkd">
						        <input type="radio" name="payment" value="" checked="checked">
						        <div class="option"></div>
						    </label>
						</div>
						<div class="sorder-list clearfloat fl">
							<i class="iconfont icon-weixinzhifu fl"></i>
							<div class="zuo fl">
								<p class="tit">微信支付</p>
								<p class="fu-tit">亿万用户的选择，更快更安全</p>
							</div>							
						</div>
					</section>
	    		</div>
	    	</div>
	    	<a href="javascript:;" class="btn-payment-wxpay fl" onclick="callpay()">
	     		确认支付
	     	</a>
	    </div>
	    
	</body>
	<script type="text/javascript" src="/statics/mobile_style/js/jquery-1.8.3.min.js" ></script>
	<script src="/statics/mobile_style/js/mui.min.js"></script>
	<script type="text/javascript" src="/statics/mobile_style/js/hmt.js" ></script>


<script>
    function paymentSuccess() {
        WeixinJSBridge.call('closeWindow');
    }
    var ajaxloaded = false;
    function ajaxCheckOrderState() {
        if (ajaxloaded) return;
        ajaxloaded = true;
        $.ajax({
            type: "get",
            dataType: "json",
            data: "order_id=<%=Order_ID %>&clienttime=" + Math.random(),
            url: 'order_query.aspx',
            error: function (XmlHttpRequest, textStatus, errorThrown) { ajaxloaded = false; if (XmlHttpRequest.responseText != "") { alert(XmlHttpRequest.responseText); } },
            success: function (d) {
                ajaxloaded = false;
                switch (d.result) {
                    case '0':
                        break;
                    case '1':
                        paymentSuccess();
                        break;
                }
            }
        });
    }
    var lastseconds = 2;
    function CheckOrderState() {
        $('body').everyTime('1s', function () {
            lastseconds--;
            if (lastseconds < 0) {
                lastseconds = 2;
                ajaxCheckOrderState();
                return;
            }
        }, 0, true);
    }
    CheckOrderState();
</script>
</html>
